<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue/vue.js"></script>
    <script src="../../js/jquery/jquery.js"></script>
</head>
<body>
    <!-- 模板 -->
    <div id="app">
        <form id="formId">
            姓名：<input type="text" name="name"><br/>
            年龄：<input type="text" name="age"><br/>
            <input type="button" value="提交" v-on:click="submitForm()">
        </form>
    </div>


    <script>
        //-------- vue 数据 -----------
        var vue = new Vue({
            el:"#app",
            methods:{
                submitForm:function () {
                    console.log(11);
                    $.post('http://127.0.0.1:8080/employees/add',$("#formId").serialize(), function (data) {
                        console.log(2222);
                        console.log(data);
                        if (data.code == 200) {
                            window.location.href = 'list.html'; ///views/demo/list.html
                        }else {
                            alert('操作失败');
                        }
                    })
                }
            }
        });
    </script>
</body>
</html>